<template>
  <div id="app">
      <!-- <router-view class="Router" :style="{top:top}"></router-view> -->
      <QSLoading @loadingFlag="loadingFlag()" v-if="pageFlag"></QSLoading>

      <QSControl v-else>
        <router-view></router-view>
      </QSControl>
  </div>
</template>

<script>
// 登录页面
import QSLoading from '@/views/QSLoading';
// 页面控制台
import QSControl from '@/views/QSControl';

export default {
  name: 'App',
  components:{
    QSLoading,
    QSControl,
  },
  data() {
    console.log('初始化',sessionStorage.getItem("loading-flag"))
    return {
      pageFlag:true,//true:登录页面     false:内容页面
    };
  },
  mounted(){
    console.log('刷新',sessionStorage.getItem("loading-flag"))
  },
  watch:{
    '$router':function(){
      this.pageFlag = sessionStorage.getItem("loading-flag");
    }
  },
  computed:{
    
  },
  methods:{
    loadingFlag(){
      this.pageFlag = !this.pageFlag;
      sessionStorage.setItem("loading-flag",this.pageFlag);//缓存 - 登录状态
    },

  },
  
}
</script>

<style>
  .Router {
  background:#fff;
  position: fixed;
  /* top:45px; */
  left: 0;
  right: 0;
  /* width: 100%; */
  height: 92%;
  overflow:scroll;
  transition: all 0.5s ease;
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
}


</style>
